<template>
    <el-menu-item :index="item.path" v-if="!item.children">
        <!-- 可自行添加图标 -->
        {{ item.meta?.title }}
    </el-menu-item>
    <el-sub-menu :index="item.path" v-else>
        <template #title>

            {{ item.meta?.title }}
        </template>
        <!-- menuItem 对应 defineOptions中的name属性 -->
        <menuItem v-for="child in item.children" :item="child" :key="child.path">
        </menuItem>
    </el-sub-menu>
</template>

<script>

</script>

<script setup lang='ts'>
import type { RouteRecordRaw } from 'vue-router';
// Vue3.3 +
defineOptions({
    name: 'menuItem'
})

defineProps<{
    item: RouteRecordRaw
}>()


</script>

<style scoped></style>